package com.lovo.lesson;

import java.util.ArrayList;
import java.util.Iterator;

public class Test01 {
    public static void main(String[] args) {
        ArrayList list = new ArrayList();
        list.add(1);
        list.add(true);
        list.add("hello");
        list.add(new Student("小强",20,"男"));

        Student stu = (Student)list.get(2);
        System.out.println(stu.getName());

        for(int i = 0;i < list.size();i++){
            System.out.println(list.get(i));
        }

        Iterator it = list.iterator();
        while(it.hasNext()){
            System.out.println(it.next());
        }

        for(Object obj : list){
            System.out.println(obj);
        }

    }
}
